
import SQLite

typealias Expression = SQLite.Expression

class DbBase {
    static var db: Connection?
    
    static func open(_ name:String) -> Bool {
        do {
            if let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
                let path = url.appendingPathComponent(name+".db")
                print("db path: \(path)")
                db = try Connection(path.absoluteString)
                return true
            }
        }catch{
            print("\(error)")
        }
        return false
    }
    func getDb() ->Connection? {
        return DbBase.db
    }
}
